package cn.edu.zjicm.wordsnet_d.adapter;

import cn.edu.zjicm.wordsnet_d.fragment.CalendarPagerFragment;
import cn.edu.zjicm.wordsnet_d.util.DateTimeUtils;
import cn.edu.zjicm.wordsnet_d.view.CalendarView.CalendarCallback;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;
import android.view.ViewGroup;

public class CalendarPagerAdapter extends FragmentStatePagerAdapter{

	private CalendarCallback calendarCallback;
	
	public CalendarPagerAdapter(FragmentManager fm,CalendarCallback calendarCallback) {
		super(fm);
		this.calendarCallback = calendarCallback;
	}

	@Override
	public Fragment getItem(int position) {
		CalendarPagerFragment.calendarCallback = calendarCallback;
		return CalendarPagerFragment.create(position);
	}

	@Override
	public int getCount() {
		int years = DateTimeUtils.getMaxYear()-DateTimeUtils.getMinYear();
		return years*12;
	}

	@Override
	public int getItemPosition(Object object) {
		return POSITION_NONE;
	}
	
}
